package com.kjcxlab.avcviewer.util;

import android.util.Log;

/**
 * Created by Xianlee on 8/7/2015.
 */
public class Logger {
    protected static String buildLog(String msg) {
        StringBuilder logBuilder = new StringBuilder();

        Exception e = new Exception();
        String className = e.getStackTrace()[2].getClassName();
        String methodName = e.getStackTrace()[2].getMethodName();

        logBuilder.append(className).append(".").append(methodName).append(": ")
                .append(msg);

        return logBuilder.toString();
    }

    public static void d(String msg) {
        Log.d(Constants.DEBUG_TAG, buildLog(msg));
    }

    public static void d() {
        Log.d(Constants.DEBUG_TAG, buildLog(""));
    }

    public static void e(String msg) {
        Log.e(Constants.DEBUG_TAG, buildLog(msg));
    }
}
